﻿using System;
using System.Collections;
using System.Configuration;
using System.Web.Configuration;
using HospitalSystem.Core;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace HospitalSystem
{
    public partial class recpromotedevelopment : System.Web.UI.Page
    {
        private recpromotedevelopmentLog _RA;
      
        string actcode = WebConfigurationManager.AppSettings["actcode"];
              

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["PSNumber01"] == null)
            {

                MessageBox2("กรุณากดค้นหา หรือลงทะเบียนการคัดกรองเด็กก่อน", "checkcid2.aspx");

            }

            else
            {
                _RA = new recpromotedevelopmentLog();


                if (!IsPostBack)
                {
                    String ShowValue = (string)Session["PSNumber01"];
                    Label1.Text = ShowValue;
                    _RA.BindDataService(GridView2, actcode);
                    _RA.readtodatatable(GridView11, GridView2, Label1, actcode);
                    _RA.BindDataMaterial(GridView1, GridView3, Label1, actcode);
                    //_RA.readtodatatable(GridView11, GridView2, Label1);
                    //_RA.BindDataService(GridView2);
                    //_RA.readtodatatable(GridView2,GridView11,Label1);

                }

            }

        }

        private void MessageBox2(string msg, string urld)
        {
            Label lbl = new Label();
            lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "');" + "window.location.href='" + urld + "';" + "</script>";
            Page.Controls.Add(lbl);
        }
       

             

        protected void Button1_Click(object sender, EventArgs e)
        {
            _RA.insertdatatodb(SelectStat, GridView2, Label1, GridView11,actcode);
           // _RA.insertdatatodb(SelectStat, GridView2, Label1, GridView11, sqlInput);
            _RA.insertdata2todb(SelectStat, GridView1, GridView3, Label1,actcode);
        }


        


    }
}